freespeechfandomcom-20200214-history
Custom error page
A custom error page is a feature of most Web server software that allows you to replace default error messages with ones you create. The default error messages tend to be fairly generic, and not particularly user-friendly, so making custom messages for a site is recommended. You can make them look more like the rest of a site, and/or provide better recovery navigation. The Not Found (404) error is the one users are most likely to encounter, so it is the most likely to be customized. Default 404 error messages *Apache *Microsoft IIS Custom 404 error message examples *News site (with "dashboard" navigation) *Corporation site (with search and random pictures) Random 404 Error Page A random 404 error page is always a nice way to go, as you can display a different helpful message each time a user encounters a 404 error. In example: http://www.fat-family.com/blah Creating custom error pages The instructions below assume you have direct access to a Web server you set up. If your site is hosted by a third party, they may have already provided one or more default error pages. Check your host's documentation. Custom error page creation using Apache HTTP Server If you run a Web server using the Apache HTTP Server software, you can easily specify custom error pages through server configuration files such as httpd.conf or .htaccess. You can specify custom error pages using the ErrorDocument directive. It is used as follows: ---- ## File paths are relative to the Document Root (/) # '404 Not Found' error ErrorDocument 404 /404.htm # '403 Forbidden' error ErrorDocument 403 /my.htm # '401 Unauthorized' error ErrorDocument 401 /401.htm # Or.. # ErrorDocument 401 "The webserver could not authorise you for content access. ---- This may be put in an .htaccess file, which can be created using a text editor. Everything defined in an .htaccess file will only take effect for the directory it is located in and its child directories. It is important to note that the 401 error response must be a relative URL, beginning with a forward slash, /, or a comment, beginning with a double quote " due to the following in httpd_core.c : if (error_number 401 && line0 != '/' && line0 != '"') { /* Ignore it... */ ap_log_error (APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, cmd->server, "cannot use a full URL in a 401 ErrorDocument " "directive --- ignoring!"); It's also very important that the 401 error response not only begins with a forward slash, there should also be no more than 1 (one) space between '401' and the forward slash /. Custom error page creation using Microsoft IIS #Use a text editor or an HTML editor to create your custom page on your server #From your server's desktop, launch the Internet Services Manager (usually located at Start->Programs->Administrative Tools->Internet Services Manager) #Click the + to the left of the server name #Right-click on "Default Web Server" (or whatever you may have renamed it as), and click on "Properties" #Click on the Custom Errors tab #Click on the number of the HTTP Error you want to make the custom message for, then click "Edit Properties" #Use the Browse button to locate the custom file you created and click OK. Keep clicking OK to dismiss the windows, then close the IIS window External links *ErrorDocument Directive in Apache HTTP Server 2.0 documentation *Customised 404 Error Pages Improving website usability with customised 404 error pages *404 Research Lab Exploring the art of the 404 page *Error Pages How to use a 404 Error Page *Custom Error for IIS Commercial Software for Error Page management on IIS 4+ Category:World Wide Web Category:Computer errors Category:HTTP